package com.njbdqn.mybuy.services;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

public class OutputService {
	private static  ObjectMapper om = new ObjectMapper();
	public static void out(HttpServletResponse response,Object obj){
		try {
			PrintWriter pw = response.getWriter();
			pw.write(om.writeValueAsString(obj));
			pw.flush();
			pw.close();
		} catch (JsonProcessingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
